// Piece.cs created with MonoDevelop
// User: dream at 16:58 15.05.2008
//
using System;

namespace CheckAndMate
{
	public enum PieceType: byte { None = 0, Pawn, Knight, Bishop, Rook, Queen, King };
	public enum PieceColor: byte { None = 0, White, Black };
	
	public struct Piece
	{	
		public Piece(PieceColor color, PieceType type)
		{
			_color = color;
			_type = type;
		}
		
		public PieceType Type
		{
			get { return _type; }
		}
		
		public PieceColor Color
		{
			get { return _color; }
		}
		
		public bool IsNull()
		{
			if (_type == PieceType.None || _color == PieceColor.None)
				return true;
			return false;
		}
		
		public override bool Equals (object o)
		{
			if (o is Piece)
			{
				Piece p = (Piece) o;
				if (p.IsNull() && this.IsNull())
				    return true;
				if (p._color == this._color && p._type == this._type)
				    return true;
				else 
					return false;
			}
			else 
				return false;
		}

		// For Debug
		public override string ToString ()
		{
			return Enum.GetName(typeof(PieceColor), _color) + " " + Enum.GetName(typeof(PieceType), _type);
		}

		
		private PieceType _type;
		private PieceColor _color;
	}
}
